package io.kubesphere.devops.core;

public class StringRemoveBackquote {
    public static String removeBackquote(String str) {
        if (str == null) {
            return str;
        }
        str = str.trim();
        //删除名字中的`tablename`和'value'
        if (str.length() >= 2) {
            char firstChar = str.charAt(0);
            int lastIndex = str.length() - 1;
            char tailChar = str.charAt(lastIndex);
            if ((firstChar == '`' && tailChar == '`') || (firstChar == '\'' && tailChar == '\'')) {
                return str.substring(1, lastIndex);
            }
        }
        return str;
    }
}
